Socket
Socket
Sign inDemoInstall

verror

Package Overview
Dependencies
Maintainers
14
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

verror

richer JavaScript errors


Version published
Weekly downloads
17M
decreased by-0.79%
Maintainers
14
Weekly downloads
 
Created

What is verror?

The verror npm package provides utilities for constructing and formatting errors in Node.js applications. It allows for richer error information, chaining of errors, and better error handling mechanisms. This package is particularly useful for applications that require detailed error tracking and reporting.

What are verror's main functionalities?

Creating rich errors

This feature allows developers to create errors that can encapsulate more information than standard Error objects. It is useful for debugging and error tracking.

const VError = require('verror');
const err = new VError('This is a rich error with a cause.');

Chaining errors

Chaining errors enables developers to trace through a sequence of errors that led to a failure, making it easier to understand the context and root cause of an issue.

const VError = require('verror');
const cause = new Error('cause');
const err = new VError(cause, 'A higher-level error.');

Formatting error messages

This feature allows for the inclusion of additional information within error objects and provides a structured way to access this information. It's particularly useful for logging and reporting errors with specific codes or data.

const VError = require('verror');
const err = new VError({
  name: 'MyError',
  info: { errorCode: 'E123' }
}, 'An error occurred.');
const info = VError.info(err);
console.log(info.errorCode); // Outputs: E123

Other packages similar to verror

Keywords

FAQs

Package last updated on 02 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc